Shell

推荐列表 站点导航

当前位置:首页 > 脚本编程 > Shell >

jsp实现pdf在线预览功能

来源:互联网  作者:网友投稿  发布时间:2021-01-10 07:02
本文介绍了jspIT之家中实现pdf在线预览功能的方法,pdf在线预览实例代码,有需要的朋友参考下。...

jsp页面 复制代码 代码示例: input type=button id=s:property value='spId'/ class=btn btn-success value=预览 onclick=viewPDF(this) / 3,script 代码 复制代码 代码示例: script type=text/javascript function viewPDF(cur){ // alert($(cur).attr('id')); var fileid = $(cur).attr('id'); var strURL = preview.action?id=+fileid; var sheight = screen.height-70; var swidth = screen.width-10; var winoption=left=0, e); e.printStackTrace(); // return this.ajaxText(打开失败); } // return ; } 2, j); } fileinputstream.close(); } catch (IOException e) { log.error(打开失败,但服务器操作系统的编码是GB2312 if (fileName != null fileName.trim().length() 0) { fileName = URLEncoder.encode(fileName,width=+swidth+。

文件路径为: + fileNameWithPath, 65000); k += j; getResponse().getOutputStream().write(abyte0,具体实现: 1、contentfile 是webroot目录下的文件夹 待预览的文件上传到此文件夹, 0。

'', pdf在线预览功能。

toolbar=yes,现在环境下的编码是UTF-8, public void preview() { String spath = ServletActionContext.getServletContext().getRealPath() + \\contentfile\\; specificate = (Specificate) baseService.getById(Specificate.class, id); String fileName = specificate.getTitle(); String fileNameWithPath = spath + \\ + specificate.getTitle(); log.info(文件名= + fileName); // File file = new File(fileName); try { // 转码(UTF-8--GB2312)。

inline; filename= + fileName); while ((long) k l) { int j; j = fileinputstream.read(abyte0,top=0, 0, location=yes,status=yes,resizable=yes; var tmp=window.open(strURL, 3、 复制代码 代码示例: spath + \\ + specificate.getTitle(); 路径加 文件名取到文件, GB2312); fileName = URLDecoder.decode(fileName,menubar=yes, 2、Specificate 存放预览文件信息的实体类(表),winoption); } /script ,height=+sheight+, ISO8859-1); } else { fileName = moren.pdf; fileNameWithPath = spath + \\ + fileName; } File file = new File(fileNameWithPath); FileInputStream fileinputstream = new FileInputStream(file); long l = file.length(); int k = 0; byte abyte0[] = new byte[65000]; getResponse().setContentType(application/pdf); getResponse().setContentLength((int) l); getResponse().setHeader(Content-Disposition,scrollbars=yes,。

相关热词:

本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供用于网络技术学习参考,学习中请遵循相关法律法规!

本文地址: https://v30.fanwenzhu.com/jiaob/shell/12261.shtml

相关文章
Copyright © www.juheyunku.com      关于 | 合作 | 声明 | 联系 | 更新 | 地图 | Tags

jsp实现pdf在线预览功能

2021-01-10 编辑:网友投稿

jsp页面 复制代码 代码示例: input type=button id=s:property value='spId'/ class=btn btn-success value=预览 onclick=viewPDF(this) / 3,script 代码 复制代码 代码示例: script type=text/javascript function viewPDF(cur){ // alert($(cur).attr('id')); var fileid = $(cur).attr('id'); var strURL = preview.action?id=+fileid; var sheight = screen.height-70; var swidth = screen.width-10; var winoption=left=0, e); e.printStackTrace(); // return this.ajaxText(打开失败); } // return ; } 2, j); } fileinputstream.close(); } catch (IOException e) { log.error(打开失败,但服务器操作系统的编码是GB2312 if (fileName != null fileName.trim().length() 0) { fileName = URLEncoder.encode(fileName,width=+swidth+。

文件路径为: + fileNameWithPath, 65000); k += j; getResponse().getOutputStream().write(abyte0,具体实现: 1、contentfile 是webroot目录下的文件夹 待预览的文件上传到此文件夹, 0。

'', pdf在线预览功能。

toolbar=yes,现在环境下的编码是UTF-8, public void preview() { String spath = ServletActionContext.getServletContext().getRealPath() + \\contentfile\\; specificate = (Specificate) baseService.getById(Specificate.class, id); String fileName = specificate.getTitle(); String fileNameWithPath = spath + \\ + specificate.getTitle(); log.info(文件名= + fileName); // File file = new File(fileName); try { // 转码(UTF-8--GB2312)。

inline; filename= + fileName); while ((long) k l) { int j; j = fileinputstream.read(abyte0,top=0, 0, location=yes,status=yes,resizable=yes; var tmp=window.open(strURL, 3、 复制代码 代码示例: spath + \\ + specificate.getTitle(); 路径加 文件名取到文件, GB2312); fileName = URLDecoder.decode(fileName,menubar=yes, 2、Specificate 存放预览文件信息的实体类(表),winoption); } /script ,height=+sheight+, ISO8859-1); } else { fileName = moren.pdf; fileNameWithPath = spath + \\ + fileName; } File file = new File(fileNameWithPath); FileInputStream fileinputstream = new FileInputStream(file); long l = file.length(); int k = 0; byte abyte0[] = new byte[65000]; getResponse().setContentType(application/pdf); getResponse().setContentLength((int) l); getResponse().setHeader(Content-Disposition,scrollbars=yes,。

本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供学习参考!
本文地址为 https://v30.fanwenzhu.com/jiaob/shell/12261.shtml

相关文章

风云图片

推荐阅读

返回Shell频道首页